﻿<phone:PhoneApplicationPage
    x:Class="DailyBread.Views.CommentThreadPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="{StaticResource AppName}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="Thread" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock x:Name="TextBlockComment"  TextWrapping="Wrap"  />
            <StackPanel Grid.Row="1" Orientation="Horizontal">
                <TextBlock Text="posted on " FontSize="14" FontStyle="Italic"/>
                <TextBlock x:Name="TexBlockCommentPostTime" FontSize="14" />
            </StackPanel>
            <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,0,0,10">
                <TextBlock x:Name="NumberOfLikes" Text="3" />
                <TextBlock Text=" Like" FontSize="16"/>
                <TextBlock x:Name="NumberOfComments" Text="5"  Margin="10,0,0,0"/>
                <TextBlock Text=" Comment" />
                <TextBlock x:Name="NumberOfPrayers" Text="10"  Margin="10,0,0,0"/>
                <TextBlock Text=" Prayer" />
            </StackPanel>
            <StackPanel Grid.Row="3" Orientation="Horizontal">
                <Button x:Name="LikeButton" Content="Like" Click="LikeButtonClick" />
                <Button x:Name="PrayButton" Content="Pray" Click="PrayButtonClick" />
            </StackPanel>
            <StackPanel Grid.Row="4" Orientation="Horizontal" Margin="0,0,0,10">
                <TextBox x:Name="CommentThreadBox"
                                 Text="Add your comments..."
                                 Foreground="Gray"
                                 GotFocus="CommentBox_GotFocus" 
                                 LostFocus="CommentBox_LostFocus"
                                 InputScope="Text"
                                 Margin="0,0,10,0" Width="363" 
                                 TextWrapping="Wrap" >
                </TextBox>
                <Image Source="images/comments-add-icon.png" MouseLeftButtonUp="PostButton_Click" Width="48" VerticalAlignment="Center" />
            </StackPanel>
            <Grid Grid.Row="5" Background="{StaticResource TransparentBackground}">
                <TextBlock x:Name="CommentThreadMessageBlock" TextWrapping="Wrap"  Visibility="Collapsed" />
            </Grid>
            <Grid Grid.Row="6" >
                <ProgressBar x:Name="CommentThreadProgressBar" Foreground="White"/>
                <ListBox x:Name="CommentThreadList" Background="{StaticResource TransparentBackground}" 
                            Height="500"     ScrollViewer.VerticalScrollBarVisibility="Auto" >
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid x:Name="CommentThreadComment" MouseLeftButtonDown="Comment_MouseLeftButtonDown">
                                <toolkit:ContextMenuService.ContextMenu>
                                    <toolkit:ContextMenu>
                                        <toolkit:MenuItem Header="delete" Click="CommentContextMenuDelete_Click"/>
                                    </toolkit:ContextMenu>
                                </toolkit:ContextMenuService.ContextMenu>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <TextBlock x:Name="TextBlockCommentThreadcomment"  TextWrapping="Wrap" Text="{Binding CommentThreadComment}" />
                                <StackPanel Grid.Row="1" Orientation="Horizontal">
                                    <TextBlock Text="posted on " FontSize="13" FontStyle="Italic"/>
                                    <TextBlock x:Name="TexBlockCommentThreadCommentPostTime" FontSize="13" Margin="0,0,0,10" Text="{Binding ThreadDateForDisplay}" />
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>